# Purpose: Defines common Pydantic models used across the application.
# Changes:
# - Corrected the usage of Field with Literal type hint for ErrorResponse.success.

from pydantic import BaseModel, Field
from typing import List, Optional, Any, Dict, Literal # Keep Literal import
import uuid
from datetime import datetime, timezone

class StatusResponse(BaseModel):
    """Standard response for operations that primarily report status."""
    success: bool = Field(..., description="Indicates if the operation was successful.")
    message: Optional[str] = Field(None, description="An optional message providing details about the status.")
    details: Optional[Any] = Field(None, description="Optional field for returning extra data.")

class ErrorDetail(BaseModel):
    """Structure for detailed error information, often used for validation errors."""
    field: Optional[str] = Field(None, description="The specific field that caused the error.")
    code: Optional[str] = Field(None, description="An optional application-specific error code.")
    description: str = Field(..., description="A human-readable description of the error.")

class ErrorResponse(BaseModel):
    """Standard error response structure used across the application."""
    # Corrected line: Use Literal in type hint, provide default and description to Field
    success: Literal[False] = Field(False, description="Always False for error responses.")
    error_type: str = Field(..., description="The type of error (e.g., 'ValidationError', 'SkillError', 'LLMError').")
    message: str = Field(..., description="A summary error message.")
    details: Optional[List[ErrorDetail]] = Field(None, description="A list of specific error details.")

# Example Base Model with common fields (optional)
class TimestampedBaseModel(BaseModel):
    id: uuid.UUID = Field(default_factory=uuid.uuid4)
    created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
    updated_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))